]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Replace setButtonSensitive by simply returning the button
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 14 Oct 2013 02:56:26 +0000 (22:56 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 21 Oct 2013 16:30:25 +0000 (12:30 -0400)
We want to remove 'id's from buttons, and simply returning the button actor
is more powerful anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=710137

js/ui/messageTray.js
js/ui/status/bluetooth.js

index f8e029ca30aa479e9fa09c0f5e5494dde8cff9e8..9a87106e420772824c79aea589d761cd74305f0f 100644 (file)
@@ -859,7 +859,6 @@ const Notification = new Lang.Class({
         }
 
         let button = new St.Button({ can_focus: true });
-        button._actionId = id;
 
         let iconName = strHasSuffix(id, '-symbolic') ? id : id + '-symbolic';
         if (this._useActionIcons && Gtk.IconTheme.get_default().has_icon(iconName)) {
@@ -874,27 +873,7 @@ const Notification = new Lang.Class({
         button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
 
         this.updated();
-    },
-
-    // setButtonSensitive:
-    // @id: the action ID
-    // @sensitive: whether the button should be sensitive
-    //
-    // If the notification contains a button with action ID @id,
-    // its sensitivity will be set to @sensitive. Insensitive
-    // buttons cannot be clicked.
-    setButtonSensitive: function(id, sensitive) {
-        if (!this._buttonBox)
-            return;
-
-        let button = this._buttonBox.get_children().filter(function(b) {
-            return b._actionId == id;
-        })[0];
-
-        if (!button || button.reactive == sensitive)
-            return;
-
-        button.reactive = sensitive;
+        return button;
     },
 
     setUrgency: function(urgency) {
index fb4bad213b5dac0edc2a0aca4362d7ab5732de7f..718a866a42c83fcbbf3371d0461c128ed682d639 100644 (file)
@@ -217,14 +217,13 @@ const PinNotification = new Lang.Class({
         }));
         this.addActor(this._entry);
 
-        this.addButton('ok', _("OK"));
+        let okButton = this.addButton('ok', _("OK"));
         this.addButton('cancel', _("Cancel"));
 
-        this.setButtonSensitive('ok', this._canActivateOkButton());
-        this._entry.clutter_text.connect('text-changed', Lang.bind(this,
-            function() {
-                this.setButtonSensitive('ok', this._canActivateOkButton());
-            }));
+        okButton.reactive = this._canActivateOkButton();
+        this._entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
+            okButton.reactive = this._canActivateOkButton();
+        }));
 
         this.connect('action-invoked', Lang.bind(this, function(self, action) {
             if (action == 'ok') {